package com.example.mybatis_demo.controller;

import com.example.mybatis_demo.mapper.UserInfoMapper;
import com.example.mybatis_demo.model.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

/**
 * @className: UserInfoController
 * @author: 芃
 * @description:
 * @date: 2024/12/23 18:54
 */
@RestController
@RequestMapping("/userinfo")
public class UserInfoController {
    @Autowired
    private UserInfoMapper userInfoMapper;

    @RequestMapping("/getAllUsers")
    public List<UserInfo> getAllUsers(){
         List<UserInfo> result = userInfoMapper.selectAll();
        for (UserInfo user: result) {
            System.out.println(user);

        }
        return result;
    }


    @RequestMapping("/getUserByUserName")
    public UserInfo getUserByUsername(String username){
        return userInfoMapper.getUserByUsername(username);
    }
}
